#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 110;
const int M = 1e9 + 7;
int n, a;

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        cin >> n;
        int sum = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> a;
            sum += a;
        }

        if (sum >= n) cout << sum -n << endl;
        else cout << 1 << endl;
    }
    return 0;
}